package com.fmm.easy;

import java.util.Arrays;

public class ArraySplit {

    public static int[][] minMaxSum(int[] nums) {
        int[][] result = new int[nums.length/2][2];
        Arrays.sort(nums);
        for (int i = 0; i < nums.length/2; i++) {
            result[i][0] = nums[2*i];
            result[i][1] = nums[2*i+1];
        }
        return result;
    }

    public static void main(String[] args) {
        int[] nums = {2,3,5,6,1,4};
        int[][] result = minMaxSum(nums);
        for (int i = 0; i < result.length; i++) {
            System.out.println(result[i][0] + " " + result[i][1]);
        }
    }
}
